FROM centos:7.2.1511

# 添加用户
RUN groupadd --gid 1000 user-dev \
  && useradd --uid 1000 --gid user-dev --shell /bin/bash --create-home user-dev

# 安装常用工具
RUN yum -y groupinstall "Development Tools"
RUN rpm --rebuilddb && yum -y install vim wget net-tools git sudo
RUN sed -i '93iuser-dev    ALL=(ALL)       NOPASSWD:ALL' /etc/sudoers
RUN rpm --rebuilddb && yum -y install libpng12.x86_64 0:1.2.50-10.el7 libpng12-devel.x86_64 0:1.2.50-10.el7
USER user-dev
# nvm node npm
RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
RUN source ~/.bashrc && nvm install v8.11.1 && nvm use v8.11.1

RUN sudo ln -s /home/user-dev/.nvm/versions/node/v8.11.1/bin/node /usr/bin/node
RUN sudo ln -s /home/user-dev/.nvm/versions/node/v8.11.1/bin/npm /usr/bin/npm
RUN npm install -g yarn

WORKDIR /data
USER root
RUN yum -y install epel-release && \
    yum -y install python-pip
RUN pip install supervisor

RUN mkdir /etc/supervisor
COPY ./supervisor/supervisord.conf /etc/supervisor/supervisord.conf
USER user-dev
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
